package GameObjects.Ships.Reactors;

import java.awt.event.ActionListener;

import GUI.BottomPanel;
import GameObjects.Instances.Instances;
import GameObjects.Physics.Position;
import GameObjects.Ships.ShipObject;
import Logic.GameTime;

public class Reactor extends ShipObject
{
//	protected double energyLevel;
//	protected double maxEnergyLevel;
	private double energyGain;
	private double energyGainPerTime;
	private GameTime timeToCharge;
	
	private double sheildCharge = 0.25;
	private double ammoCharge = 0.25;
	private double hyperdriveCharge = 0.25;
	private double movementCharge = 0.25;
	
	public Reactor(Instances instances, Position position, double health, double energyGainPerTime, int timeToCharge)
	{
		super(instances, position, health);
		this.timeToCharge = new GameTime(timeToCharge);
		this.energyGainPerTime = energyGainPerTime;
		this.energyGain = 0;
	}
	
	@Override
	public boolean tick()
	{
		if(timeToCharge.hasTickedOver() && hasHealth())
			this.energyGain = this.energyGainPerTime;
		else
			this.energyGain = 0;
		return false;
	}
	
	@Override
	public void setPanel(ActionListener actionListener, BottomPanel panel)
	{
//		panel.addObjectPanelBottomRight(new ReactorPanel(actionListener));
	}
	
	public double getSheildEnergy()
	{
		return sheildCharge * energyGain;
	}
	
	public double getMovementEnergy()
	{
		return movementCharge * energyGain;
	}
	
	public double getWeaponEnergy()
	{
		return ammoCharge * energyGain;
	}
	
	public double getHyperdriveEnergy()
	{
		return hyperdriveCharge * energyGain;
	}
	
	@Override
	public String toString()
	{
		return "";
	}
	
//	public boolean useEnergy(double cost)
//	{
//		if(this.energyLevel - cost > 0)
//		{
//			this.energyLevel -= cost;
//			return true;
//		}
//		return false;
//	}	
}